﻿using System;

namespace CzfSDK
{
	public static class TimeTool
	{

		/// <summary>
		/// 获取当前的时间戳(毫秒)
		/// </summary>
		/// <returns>The time stamp.</returns>
		public static long GetTimeStampMilliseconds()
		{
			return GetTimeStampMilliseconds (DateTime.Now);
		}

		/// <summary>
		/// 获取时间戳(毫秒)
		/// </summary>
		/// <returns>The time stamp.</returns>
		/// <param name="time">Time.</param>
		public static long GetTimeStampMilliseconds(this DateTime time)
		{
			return Convert.ToInt64((time.ToUniversalTime() - new DateTime (1970, 1, 1, 0, 0, 0, 0)).TotalMilliseconds);
		}
	}
}

